package com.insigma.business.common.utils;

import com.insigma.framework.encryptor.encryption.util.SM4Utils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class PriInfoHandleUtil {
    private static String key = "Epsoft@2024!@#$%";

    public static String encrypt(String info) {
        if (info.length()==32 || info.length()==64) {
            return info;
        } else {
            return SM4Utils.encryptDataByECB(info, key);
        }
    }

    public static String decrypt(String info) {
        if (StringUtils.hasText(info) && (info.length()==32 || info.length()==64)) {
            return SM4Utils.decryptDataECB(info, key);
        } else {
            return info;
        }
    }

    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        String s = "";
        Object[] ret = {s};
        list.add("1");
        list.add("2");
        list.add("3");
        System.out.println(String.join(",", list));
        System.out.println(encrypt("330124199110271618"));
        System.out.println(encrypt("13598668940"));
    }
}
